<%@ Page Title="" Language="C#" MasterPageFile="~/SalesOneWeb.Master" AutoEventWireup="true" CodeBehind="JobScheduler.aspx.cs" Inherits="IronOne.SalesOne.SalesOneWeb.BatchJob.JobScheduler" %>


<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../StyleSheets/salesOne_txtstyle.css" rel="stylesheet" type="text/css" />
    
    <script language="javascript" type="text/javascript">

        window.onload = function() {
            document.getElementById('ctl00_ContentPlaceHolder1_Occurance').value = "Daily";
            changeOccur('day');
            changeFreq('at');
        }

        function changeOccur(type) {
            var flag = false;
            if (type == "day")
                flag = true;

            document.getElementById('ctl00_ContentPlaceHolder1_txtDay').disabled = !flag;
            document.getElementById('ctl00_ContentPlaceHolder1_txtMonth').disabled = !flag;
            document.getElementById('ctl00_ContentPlaceHolder1_txtTime').disabled = flag;
            document.getElementById('ctl00_ContentPlaceHolder1_ddlType').disabled = flag;
            document.getElementById('ctl00_ContentPlaceHolder1_txtMonth1').disabled = flag;
        }

        function changeFreq(type) {
            var flag = false;
            if (type == "at")
                flag = true;

            document.getElementById('ctl00_ContentPlaceHolder1_txtEvery').disabled = flag;
            document.getElementById('ctl00_ContentPlaceHolder1_ddlTimeType').disabled = flag;
            document.getElementById('ctl00_ContentPlaceHolder1_txtStart').disabled = flag;
            document.getElementById('ctl00_ContentPlaceHolder1_txtEnd').disabled = flag;
            document.getElementById('ctl00_ContentPlaceHolder1_txtAt').disabled = !flag;
        }
        
        function checking(flag) {
            document.getElementById('ctl00_ContentPlaceHolder1_txtEndDate').disabled = flag;
        }
        
        function changeselection() {
            var ddl = document.getElementById('ctl00_ContentPlaceHolder1_Occurance');
            
            document.getElementById('daily').style.display = "none";
            document.getElementById('monthly').style.display = "none";
            document.getElementById('weekly').style.display = "none";
            
            if (ddl.value == "Daily") {
                document.getElementById('daily').style.display = "block";
            }
            else if (ddl.value == "Monthly") {
                document.getElementById('monthly').style.display = "block";
            }
            else {
                document.getElementById('weekly').style.display = "block";
            }
        }
    
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table  class="detailstable">
        <tr class="tabletitle">
            <td>
                Batch Scheduler</td>
            
        </tr>
        <tr>
            <td  height="5"></td>
            
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td width="150">
                            Available Jobs:</td>
                        <td >
                            <asp:DropDownList ID="DropDownList2" runat="server" CssClass="ddl">
                            </asp:DropDownList>
                            </td>
                        <td width="5">
                            </td>
                        <td>
                            <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
                                Text="Refresh" CssClass="btn" />
                            </td>
                    </tr>
                    <tr>
                        <td>
                            Schedule Type:</td>
                        <td>
                            <asp:DropDownList ID="DropDownList3" runat="server" CssClass="ddl">
                                <asp:ListItem>Recurring</asp:ListItem>
                                <asp:ListItem>One time</asp:ListItem>
                            </asp:DropDownList>
                            </td>
                        <td>&nbsp;
                            </td>
                        <td>&nbsp;
                            </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:CheckBox ID="CheckBox1" runat="server" CssClass="chbox" Text="Enabled" />
                            </td>
                        <td>
                            </td>
                        <td>&nbsp;
                            </td>
                        <td>
                            </td>
                    </tr>
                </table>
                </td>
           
        </tr>
        <tr>
            <td height="5"></td>
           
        </tr>
        </table>
        
        <table id="filter" runat="server" class="detailstable">
        <tr class="tabletitle">
            <td>
                Frequency</td>
           
        </tr>
        <tr>
            <td  height="9">                </td>
           
        </tr>
        <tr>
            <td>
                <table >
              <tr>
                        <td><table  border="0" cellspacing="0">
                                <tr>
                                  <td width="150">Occurs: </td>
                                  <td><asp:DropDownList ID="Occurance" runat="server" CssClass="ddl" onchange="changeselection();">
                                      <asp:ListItem Selected="True">Daily</asp:ListItem>
                                      <asp:ListItem>Weekly</asp:ListItem>
                                      <asp:ListItem>Monthly</asp:ListItem>
                                      </asp:DropDownList></td>
                                </tr>
                              </table></td>
                </tr>
                    <tr>
                        <td>
                            
                            <div id="monthly" style="display:none"><%--style="display:none"--%>
                                                            <table>
                                                            <tr>
                                                                <td>
                                                                    <asp:RadioButton ID="RadioButton3" runat="server" Text="Day" GroupName="Month" 
                                                                        onclick="changeOccur('day');" Checked="True"/></td>
                                                                <td width="5">                                                                    </td>
                                                                <td>
                                                                    <table>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:TextBox ID="txtDay" runat="server" CssClass="txtbox"></asp:TextBox>
                                                                                of every                                                                                </td>
                                                                            <td width="5">                                                                                </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtMonth" runat="server" CssClass="txtbox" 
                                                                                    ></asp:TextBox>month(s)</td>
                                                                        </tr>
                                                                    </table>                                                                </td>
                                                            </tr>
                                                        
                                                            <tr>
                                                                <td>
                                                                    <asp:RadioButton ID="RadioButton4" runat="server" Text="The" CssClass="chbox" 
                                                                        GroupName="Month" onclick="changeOccur('at');"/>                                                                </td>
                                                                <td>&nbsp;                                                                    </td>
                                                                <td><table>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:TextBox ID="txtTime" runat="server" CssClass="txtbox"></asp:TextBox>&nbsp;
                                                                                <asp:DropDownList
                                                                                    ID="ddlType" runat="server" CssClass="ddl" ></asp:DropDownList> of every</td>
                                                                             <td width="5">                                                                                </td>
                                                                            <td>
                                                                                <asp:TextBox ID="txtMonth1" runat="server" CssClass="txtbox"></asp:TextBox>month(s)</td>
                                                                        </tr>
                                                                    </table></td>
                                                            </tr>
                                                        </table>
                            </div>
                            <div id="weekly" style="display:none">
                                                                <table>
                                                                    <tr>
                                                                        <td width="150">
                                                            Recures every:</td>
                                                        <td>
                                                            <asp:TextBox ID="TextBox3" runat="server" CssClass="txtbox"></asp:TextBox>
                                                            Week(s) on</td>
                                                    </tr>
                                                    <tr>
                                                        <td>                                                            </td>
                                                        <td>
                                                        
                                                            <table style="width:100%;">
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox2" runat="server" Text="Monday" />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox3" runat="server" Text="Tuesday" />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox4" runat="server" Text="Wednesday " />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox5" runat="server" Text="Wednesday " />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox6" runat="server" Text="Thursday" />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox7" runat="server" Text="Friday" />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox8" runat="server" Text="Saturday" CssClass="chbox" />                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:CheckBox ID="CheckBox9" runat="server" Text="Sunday" />                                                                    </td>
                                                                </tr>
                                                            </table>                                                            </td>
                                                                    </tr>
                                                                </table>
                            </div>
                            <div id="daily">
                                                                <table>
                                                                    <tr>
                                                                        <td width="150">
                                                            Recures every:</td>
                                                        <td>
                                                            <asp:TextBox ID="TextBox9" runat="server" CssClass="txtbox" ></asp:TextBox>
                                                            <cc1:NumericUpDownExtender ID="TextBox9_NumericUpDownExtender" runat="server" 
                                                                Enabled="True" Maximum="100" 
                                                                Minimum="1" RefValues="" ServiceDownMethod=""
                                                                ServiceDownPath="" ServiceUpMethod="" Tag="" TargetButtonDownID="" 
                                                                TargetButtonUpID="" TargetControlID="TextBox9" Width="50">
                                                            </cc1:NumericUpDownExtender>
                                                            Day(s) on</td>
                                                                    </tr>
                                                                </table>
                            </div>                            </td>
                    </tr>
                    </table>
          </td>
           
        </tr>
        <tr>
            <td height="5">
                </td>
           
        </tr>
        <tr class="tabletitle">
            <td>
                Daily Frequency</td>
           
        </tr>
        <tr>
            <td height="5">
                </td>
           
        </tr>
        <tr>
            <td>
                <table >
                    <tr>
                        <td width="150">
                            <asp:RadioButton ID="at" runat="server" GroupName="DailyFreq" 
                                Text="Occurs once at:" onclick="changeFreq('at');" Checked="True" />
                        </td>
                        <td>
                            <asp:TextBox ID="txtAt" runat="server" CssClass="txtbox"></asp:TextBox>
                            <cc1:NumericUpDownExtender ID="txtAt_NumericUpDownExtender" runat="server" 
                                Enabled="True" Maximum="60" 
                                Minimum="1" RefValues="" ServiceDownMethod="" 
                                ServiceDownPath="" ServiceUpMethod="" Tag="" TargetButtonDownID="" 
                                TargetButtonUpID="" TargetControlID="txtAt" Width="50">
                            </cc1:NumericUpDownExtender>
                        </td>
                        <td>&nbsp;
                            </td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <asp:RadioButton ID="every" runat="server" GroupName="DailyFreq" 
                                Text="Occures every:" onclick="changeFreq('every');"/>
                        </td>
                        <td nowrap="nowrap">
                            <asp:TextBox ID="txtEvery" runat="server" CssClass="txtbox"></asp:TextBox>
                            <cc1:NumericUpDownExtender ID="txtEvery_NumericUpDownExtender" runat="server" 
                                Enabled="True" Maximum="60" 
                                Minimum="1" RefValues="" ServiceDownMethod="" 
                                ServiceDownPath="" ServiceUpMethod="" Tag="" TargetButtonDownID="" 
                                TargetButtonUpID="" TargetControlID="txtEvery" Width="50">
                            </cc1:NumericUpDownExtender>
                            &nbsp;
                            <asp:DropDownList ID="ddlTimeType" runat="server" CssClass="ddl">
                                <asp:ListItem Selected="True">hour(s)</asp:ListItem>
                                <asp:ListItem>minute(s)</asp:ListItem>
                                <asp:ListItem>second(s)</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td width="150">
                            Starting at:</td>
                        <td>
                            <asp:TextBox ID="txtStart" runat="server" CssClass="txtbox"></asp:TextBox>
                            <cc1:NumericUpDownExtender ID="txtStart_NumericUpDownExtender" runat="server" 
                                Enabled="True" Maximum="60" 
                                Minimum="1" RefValues="" ServiceDownMethod="" 
                                ServiceDownPath="" ServiceUpMethod="" Tag="" TargetButtonDownID="" 
                                TargetButtonUpID="" TargetControlID="txtStart" Width="50">
                            </cc1:NumericUpDownExtender>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;
                            </td>
                        <td>&nbsp;
                            </td>
                        <td>
                            Ending at:</td>
                        <td>
                            <asp:TextBox ID="txtEnd" runat="server" CssClass="txtbox"></asp:TextBox>
                            <cc1:NumericUpDownExtender ID="txtEnd_NumericUpDownExtender" runat="server" 
                                Enabled="True" Maximum="60" 
                                Minimum="1" RefValues="" ServiceDownMethod="" 
                                ServiceDownPath="" ServiceUpMethod="" Tag="" TargetButtonDownID="" 
                                TargetButtonUpID="" TargetControlID="txtEnd" Width="50">
                            </cc1:NumericUpDownExtender>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;
                            </td>
                        <td>&nbsp;
                            </td>
                        <td>&nbsp;
                            </td>
                        <td></td>
                    </tr>
                </table>
                </td>
           
        </tr>
        <tr>
            <td height="5">
                </td>
           
        </tr>
        <tr class="tabletitle">
            <td>
                Duration</td>
           
        </tr>
        <tr>
            <td height="5">
                </td>
           
        </tr>
        <tr>
            <td>
                <table >
                    <tr>
                        <td width="150">
                            Start date:</td>
                        <td>
                            <asp:TextBox ID="TextBox5" runat="server" CssClass="txtbox"></asp:TextBox>&nbsp;
                            <img src="../images/calander.jpg" />
                        </td>
                        <td width="5">
                            </td>
                        <td>&nbsp;
                            </td>
                    </tr>
                    <tr>
                        <td>
                            End date:</td>
                        <td>
                            <asp:TextBox ID="txtEndDate" runat="server" CssClass="txtbox"></asp:TextBox>&nbsp;
                            <img src="../images/calander.jpg" />
                        </td>
                        <td>&nbsp;
                            </td>
                        <td>
                            <asp:CheckBox ID="CheckBox10" runat="server" Text="No End date" onclick="checking(this.checked);" />
                        </td>
                    </tr>
                    </table>
                </td>
           
        </tr>
        <tr>
            <td height="5">
            </td>
        </tr>
         <tr>
            <td  align="right">
                <table >
                    <tr>
                        <td>
                            <asp:Button ID="Button4" runat="server" Text="Apply" CssClass="btn" />
                        </td>
                        <td width="5"></td>
                        <td>
                            <asp:Button ID="Button3" runat="server" Text="History" CssClass="btn" />
                        </td>
                        <td width="5"></td>
                        <td>
                            <asp:Button ID="Button2" runat="server" Text="Cancel" CssClass="btn" /> 
                        </td>
                    </tr>
                    </table>
            </td>
        </tr>
    </table>
</asp:Content>
